/**
 * 拉框查询控件
 * @class OpenLayers.Control.RectQuery
 * 继承自: - <OpenLayers.Control>
 * @requires extend/Control/PointQuery.js
 */
OpenLayers.Control.RectQuery = OpenLayers.Class(OpenLayers.Control.PointQuery,{

	/**
	 * 工具按钮提示文字
	 * @property title
	 * @type {String}
	 */
	title : "框查",
	
	/**
	 * 控件被触发时设置鼠标手势
	 * @method activate
	 */
	activate : function() {
		OpenLayers.Control.PointQuery.prototype.activate.apply(this,arguments);
		this.map.layerContainerDiv.style.cursor = "url("
				+ OpenLayers.Util.getRootPath()
				+ "img/RectQuery.cur),default";
	},

	/**
	 * @method draw
	 */
	draw : function() {
		this.handler = new OpenLayers.Handler.Box(this, {
			done : this.executeQuery
		});
	},
	
	/**
	 * evt转为空间对象geometry 
	 */
	evtToCoord : function(evt) {
		if (evt instanceof OpenLayers.Bounds) {
            var leftBottom = this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(evt.left,evt.bottom));
            var rightTop = this.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(evt.right,evt.top));
            return leftBottom.lon + "," + leftBottom.lat +","+rightTop.lon + "," + rightTop.lat;
        } else { // it's a pixel
            alert("请做拉框查询！");
            return null;
        }
	},

	CLASS_NAME : "OpenLayers.Control.RectQuery"
});